package org.thomias.exo6.monitor;

public class MonitorableTask extends Task {

	public int i;

	public MonitorableTask(String name) {
		super(name);
		i = 0;
	}

	@Override
	public void run() {
		setStartTime();
		try {

			double speed = Math.random();
			for (i = 0; i < 100; i++) {
				final long sleep = (long) (speed * Math.random() * 1000);
				Thread.sleep(sleep);
			}
		} catch (InterruptedException e) {
			// e.printStackTrace();
		}
	}
	
	@Override
	public boolean isComplete() {
		return i == 100 || bIsComplete;
	}
}
